<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model= "a"> * <input type="text" v-model= "b">
        <button v-on:click="onClick">=</button>{{result}}
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>

    <script>
        // 表单操作 可以直接利用v-model指令绑定表单项，动态获取用户输入的内容
        var vm = new Vue({
            el: "#app",
            data: {
                a:"",
                b:"",
                result: ""
            },
            methods: {   // methods  写各种方法, 方法的this的指向 就是 当前vm实例
                onClick(){
                    this.result = this.a * this.b
                }

            }
        })
    </script>
</body>
</html>